#include "marble_texture.hpp"

/* ! 1: Const Function issue*/
vec3f MarbleTexture::value( const vec2f &uv, const vec3f &p ) const {
  f32 tmp = scale * noiseUntil.turbulence( p * freq, octaves );
  f32 t = 2.f * fabs( sin( freq * p.x ) + tmp );
  if ( t < 1.f ) {
    return ( cols[1] * t ) + cols[2] * ( 1.f - t );
  } else {
    t -= 1.f;
    return ( cols[0] * t ) + cols[1] * ( 1.f - t );
  }
}